<div>
    <div class="head">
        <h2 class="d-inline-block">Application Instances</h2>
        <jhi-refresh-selector class="float-right refresh-left-side"></jhi-refresh-selector>
    </div>

    <div class="apps col-md-5" *ngIf="applications">
        <ul class="list-group">
            <li class="list-group-item {{application.active}}"
                *ngFor="let application of applications | orderBy:orderProp"
                (click)="selectActiveApplication(application.name)">
                <fa-icon icon="alert" *ngIf="checkInstanceLength(application.instances)"></fa-icon>{{application.name}}
                <span class="badge badge-pill font-weight-normal badge-info">{{displayCountInstances(application.instances)}}</span>
            </li>
        </ul>
    </div>
    <div class="row" *ngIf="instances">
        <div id="instances" class="col-md-12">
            <h3>Instances</h3>
            <div class="table-responsive">
                <table class="table table-striped table-bordered table-responsive d-table">
                    <thead>
                    <tr>
                        <th class="w-50">ID</th>
                        <th class="w-50">Status</th>
                    </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let instance of instances">
                            <td>
                                <a href="{{instance.homePageUrl}}" target="_blank">{{instance.instanceId}}</a>
                            </td>
                            <td class="text-left">
                                <span class="badge badge-pill font-weight-normal badge-success" [ngClass]="getBadgeClass(instance.status)">
                                    {{instance.status}}
                                </span>
                                <span class="float-right" *ngFor="let entry of (instance.metadata | keys )">
                                    <span class="badge badge-default font-weight-normal">
                                        <span class="badge badge-pill badge-info font-weight-normal">{{entry.key}}</span>
                                        {{entry.value}}
                                    </span>
                                </span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
